/**
 * @file 03_vla.c
 * @author your name (you@domain.com)
 * @brief 变长数组
 * @version 0.1
 * @date 2023-03-07
 *
 * @copyright Copyright (c) 2023
 *
 */

#include <stdio.h>
#include <string.h>

int main(void)
{
    //地址值从高到低：&b &a &n arr1 arr2
    int n;
    int a = 111;

    printf("input: ");
    scanf("%d", &n);

    int arr1[n];
    int arr2[2 * n];
    memset(arr1, a, n);
    memset(arr2, a / 2, 2 * n);

    int b = 0;
    for (int i = 0; i < n; i++)
    {
        b += arr1[i];
    }
    for (int i = 0; i < 2 * n; i++)
    {
        b += arr2[i];
    }

    printf("%p %p %p %p %p\n", &n, &a, arr1, arr2, &b);
}